﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using DataServer;
using Model;

namespace LogicServer
{
    public class UpLoadFileLogic
    {
        /// <summary>
        /// 获取所有文件列表
        /// </summary>
        /// <returns></returns>
        public DataTable GetAllFile(int size,int index)
        {
            UpFileData up = new UpFileData();
            return up.GetAllFile(size,index);
        }

        /// <summary>
        /// 不带分页控件的文件列表
        /// </summary>
        /// <returns></returns>
        public DataTable GetAllFileNoPageing()
        {
            UpFileData up = new UpFileData();
            return up.GetAllFile();
        }

        /// <summary>
        /// 获取文件的count
        /// </summary>
        /// <param name="size"></param>
        /// <param name="index"></param>
        /// <returns></returns>
        public int GetFileCount(int size, int index)
        {
            UpFileData up = new UpFileData();
            return up.GetFilesCount(size, index);
            
        }

        /// <summary>
        /// 上传文件成功并添加到数据库
        /// </summary>
        /// <param name="file"></param>
        /// <returns></returns>
        public bool AddFile(FilesTable file)
        {
            UpFileData uf = new UpFileData();
            return uf.AddFile(file);
        }

        /// <summary>
        /// 删除文件并更新数据库
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool DeleteFile(int id)
        {
            UpFileData uf = new UpFileData();
            return uf.DelFile(id);
        }
    }
}
